package com.his.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.his.pojo.CheckRequest;
import com.his.pojo.MedicalTechnology;
import com.his.pojo.Register;
import com.his.service.CheckRequestService;
import com.his.mapper.CheckRequestMapper;
import net.sf.jsqlparser.util.deparser.CreateIndexDeParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【check_request】的数据库操作Service实现
* @createDate 2024-10-17 09:20:15
*/
@Service
public class CheckRequestServiceImpl extends ServiceImpl<CheckRequestMapper, CheckRequest>
    implements CheckRequestService{

    @Autowired
    private CheckRequestMapper checkRequestMapper;
    @Override
    public List<MedicalTechnology> queryCheckRequestList(String caseNumber, String realName) {
        return checkRequestMapper.queryCheckReqeustListMapper(caseNumber,realName);
    }

    @Override
    public Map<String, Object> queryNoCheckListService(Integer pageNumber,Integer pageSize,
                                                       String caseNumber, String realName) {

        //指定分页参数
        Page<Register> page = PageHelper.startPage(pageNumber, pageSize);
        //查询数据库
        List<Register> registers = checkRequestMapper.queryNoCheckListMapper(caseNumber, realName);
        Map<String, Object> result=new HashMap<>();
        result.put("total",page.getTotal());
        result.put("registers",registers);
        return result;
    }

    @Override
    public MedicalTechnology queryCheckItemListService(Integer id) {
        return checkRequestMapper.queryCheckRequsetItemMapper(id);
    }
    @Override
    public Map<String, Object> queryCheckingListService(
            Integer pageNum, Integer pageSize
            , String caseNumber, String realName) {
        //指定分页参数
        Page<Register> page = PageHelper.startPage(pageNum, pageSize);
        //查询数据库
        List<Register> registers = checkRequestMapper
                .queryCheckRequestCheckingMapper(caseNumber, realName,"检查进行中");
        Map<String, Object> result=new HashMap<>();
        result.put("total",page.getTotal());
        result.put("registers",registers);
        return result;
    }

    @Override
    public List<MedicalTechnology> queryCheckedRequestList(Integer id) {
        return checkRequestMapper.queryCheckedMedicalMapper(id);
    }

    @Override
    public CheckRequest queryCheckResultService(Integer id) {
        return checkRequestMapper.queryCheckRequestByIdMapper(id);
    }
}




